home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / objcissu.lha / messages-to-nil < prev    next >
Text File  |  1993-03-01  |  7KB  |  177 lines

  1. From: Patrick Rusk <rusk@marble.com>
  2. Date: Thu, 12 Nov 92 16:43:46 -0500
  3. To: gsk@marble.com
  4. Subject: GNU Objective-C suggestion
  5.  
  6. Geoffrey,
  7.  
  8. I just spent a good bit of time looking up a bug that resulted from a
  9. message being passed to "nil" and not causing an error. I would like
  10. to recommend that the GNU Objective-C runtime work differently. It
  11. should have a nil object that has methods to respond to errors like
  12. this. Perhaps the default error handler should be to ignore the errors
  13. like NeXT Objective-C does, but the opportunity to bomb out should be
  14. given.
  15.  
  16. -- Pat
  17.  
  18. Return-Path: <rms@gnu.ai.mit.edu>
  19. Date: Tue, 16 Feb 93 16:48:00 -0500
  20. From: rms@gnu.ai.mit.edu (Richard Stallman)
  21. To: krab@iesd.auc.dk
  22. Cc: krab@iesd.auc.dk, gsk@marble.com
  23. In-Reply-To: <199302162120.AA03198@iesd.auc.dk> (message from Kresten Krab Thorup on Tue, 16 Feb 1993 22:20:23 +0100)
  24. Subject: gnu objc runtime
  25.  
  26.     a considerably number of bugs, and introduced some features like
  27.     optional handling of messages send to nil, and much better
  28.     initialization of the system.
  29.  
  30. It occurs to me that this feature might interfere with the goal of making
  31. method lookup faster and open-coding it.  If so, then it is important
  32. *not* to have this feature.  If people start using it, they will be unhappy
  33. when it is taken out.  And it is not a very important feature.
  34.  
  35. Have you read the file of ideas that comes with the runtime?
  36.  
  37. Return-Path: <krab@iesd.auc.dk>
  38. Date: Wed, 17 Feb 1993 01:19:29 +0100
  39. From: Kresten Krab Thorup <krab@iesd.auc.dk>
  40. To: rms@gnu.ai.mit.edu, gsk@marble.com
  41. Subject: gnu objc runtime
  42.  
  43. Stallman writes:
  44.  
  45.   [Concerning sending messages to nil i guess...] 
  46.   It occurs to me that this feature might interfere with the goal of making
  47.   method lookup faster and open-coding it.  If so, then it is important
  48.   *not* to have this feature.  If people start using it, they will be unhappy
  49.   when it is taken out.  And it is not a very important feature.
  50.    
  51.   Have you read the file of ideas that comes with the runtime?
  52.  
  53. Yes I did read the file of ideas, and most of the ideas are
  54. incorporated into my runtime system.  The handling of messages to nil
  55. isn't expensive, actually my objc_msgSend looks like this:
  56.  
  57.     extern Class_t nilClass;
  58.   
  59.     if(receiver != nil)            /* send msg to reciever */
  60.       return get_imp(receiver->class_pointer, sel);
  61.  
  62.     else                /* otherwise send it to nil */
  63.       return get_imp(nilClass, sel);
  64.  
  65. Now, if the message happens to be send to `Nil' it is caught by
  66. -doesNotRecognize: in that class, which can then choose to ignore the
  67. message or issue an error.  OK, This is a bit more expensive if
  68. someone sends a terrible lot of messages to NULL pointers, but who
  69. would ever call that good programming style anyway?
  70.  
  71. [...moved...the matter of initialization...]
  72.  
  73. Return-Path: <rms@gnu.ai.mit.edu>
  74. Date: Wed, 17 Feb 93 00:22:01 -0500
  75. From: rms@gnu.ai.mit.edu (Richard Stallman)
  76. To: krab@iesd.auc.dk
  77. Cc: gsk@marble.com
  78. In-Reply-To: <199302170019.AA04534@iesd.auc.dk> (message from Kresten Krab Thorup on Wed, 17 Feb 1993 01:19:29 +0100)
  79. Subject: gnu objc runtime
  80.  
  81.       The handling of messages to nil
  82.     isn't expensive, actually my objc_msgSend looks like this:
  83.  
  84.     extern Class_t nilClass;
  85.  
  86.     if(receiver != nil)            /* send msg to reciever */
  87.       return get_imp(receiver->class_pointer, sel);
  88.  
  89.     else                /* otherwise send it to nil */
  90.       return get_imp(nilClass, sel);
  91.  
  92.  
  93. Please take this out.
  94.  
  95. It is clear that you didn't get the point.  I want this function to be
  96. *open-coded*.  That means we have to eliminate almost everything now
  97. in it.
  98.  
  99. Adding a new statement, even something that seems simple,
  100. is going in EXACTLY the wrong direction.
  101.  
  102. Just because something sounds like a feature DOES NOT mean
  103. it is a good idea!
  104.  
  105. Return-Path: <rms@gnu.ai.mit.edu>
  106. Date: Wed, 17 Feb 93 14:15:16 -0500
  107. From: rms@gnu.ai.mit.edu (Richard Stallman)
  108. To: gsk@marble.com
  109. To: krab@iesd.auc.dk
  110. In-Reply-To: <199302171615.AA00184@carrara> (gsk@marble.com)
  111. Subject: gnu objc runtime
  112.  
  113. It is possible that there is some really important reason not to open-code
  114. the dispatcher.  For example, there could be a feature that *users want
  115. very much* that is incompatible with open-coding.  I could easily not know
  116. about it, since I am not an Objective C user.
  117.  
  118. However, a feature added just because it seems possibly neat is not enough
  119. of a reason.  Neither is something used for internal purposes if there is
  120. a way to avoid the need for it.
  121.  
  122. This is because open-coding will make dispatch significantly faster,
  123. and I know users will like that.  It will make it feasible to use
  124. messages for smaller things.
  125.  
  126. Return-Path: <krab@iesd.auc.dk>
  127. Date: Wed, 17 Feb 1993 21:27:59 +0100
  128. From: Kresten Krab Thorup <krab@iesd.auc.dk>
  129. To: gsk@marble.com, rms@gnu.ai.mit.edu
  130. Subject: gnu objc runtime
  131. Cc: krab.It.is.possible.that.there.is.some.really.important.reason.not.to.open-code.the.dispatcher.For.example@iesd.auc.dk,
  132.         there.could.be.a.feature.that.*users.want.very.much*.that.is.incompatible.with.open-coding.I.could.easily.not.know.about.it@iesd.auc.dk,
  133.         since.I.am.not.an.Objective.C.user.However@iesd.auc.dk,
  134.         a.feature.added.just.because.it.seems.possibly.neat.is.not.enough.of.a.reason.Neither.is.something.used.for.internal.purposes.if.there.is.a.way.to.avoid.the.need.for.it.@iesd.auc.dk
  135.  
  136. The only good reason I could think of was for having a special
  137. messenger used during initialization, but if forwarding is possible it
  138. should not be needed as far as I can see.
  139.  
  140.    This is because open-coding will make dispatch significantly faster,
  141.    and I know users will like that.  It will make it feasible to use
  142.    messages for smaller things.
  143.  
  144. Another approach than the forwarding one I just send you, is to have
  145. the messenger look like this:
  146.  
  147.    IMP
  148.    objc_msgSend(id receiver, SEL selector)
  149.    {
  150.      if (__objc_alternative_msgSend != 0)
  151.        return (*__objc_alternative_msgSend)(receiver, selector);
  152.      else
  153.       <do normal selector here>
  154.    }  
  155.  
  156. This will only cost a single fetch/branch instruction to perform, and
  157. it could easily be inlined by hardcoding it into gcc (I assume that is
  158. what open-coding means?).  
  159.  
  160. /Kresten
  161.  
  162. Return-Path: <rms@gnu.ai.mit.edu>
  163. Date: Wed, 17 Feb 93 15:40:35 -0500
  164. From: rms@gnu.ai.mit.edu (Richard Stallman)
  165. To: krab@iesd.auc.dk
  166. Cc: gsk@marble.com
  167. In-Reply-To: <199302172027.AA14400@iesd.auc.dk> (message from Kresten Krab Thorup on Wed, 17 Feb 1993 21:27:59 +0100)
  168. Subject: gnu objc runtime
  169.  
  170. Each additional thing that the message lookup has to do means a few
  171. additional instructions for *every* message send.
  172.  
  173. It may be *possible* to open-code it with the extra indirection.  I
  174. don't want to!  Stop exploring that possibility and look for a way to
  175. *get rid* of the extra indirection.
  176.  
  177.